package com.huluobo.lc.giftdemo1806a;

import androidx.appcompat.app.AppCompatActivity;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;

public class MainActivity extends AppCompatActivity {
    LinearLayout giftContainer;
    Button gift1, gift2, gift3;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
//        LinearLayout linearLayout = findViewById(R.id.ll);
//        GiftView giftView = new GiftView(this, new AnimMessage("lc", 1, "灰机"));
//        linearLayout.addView(giftView);
        AnimationManager.init(this);
        giftContainer = findViewById(R.id.ll_gift_container);
        AnimationManager.addGiftContainer(giftContainer);

        findViewById(R.id.gift_1).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AnimationManager.addAnimalMessage(new AnimMessage("lc", 10, "黄瓜"));
            }
        });

        findViewById(R.id.gift_2).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AnimationManager.addAnimalMessage(new AnimMessage("hb", 10, "茄子"));
            }
        });

        findViewById(R.id.gift_3).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                AnimationManager.addAnimalMessage(new AnimMessage("yxx", 10, "香蕉"));
            }
        });
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        AnimationManager.release();
    }
}